package cc.opcol.iot.app.util;

import cc.opcol.iot.app.vo.GeneralQueryCondition;
import org.apache.commons.lang.StringUtils;
import org.springframework.data.mongodb.core.query.BasicQuery;

public class MongodbUtil {

    public static BasicQuery newQuery(GeneralQueryCondition condition) {
        String where="{}";
        if(!StringUtils.isBlank(condition.getWhere())){
            where=condition.getWhere();
        }
        String fields="{}";
        if(!StringUtils.isBlank(condition.getFields())) {
            fields=condition.getFields();
        }
        return new BasicQuery(where,fields);

    }
}
